﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace FileUpload.Controllers
{
    public class LoginController : Controller
    {
        // GET: Login
        public ActionResult Index()
        {
            HttpCookie cookie = Request.Cookies["UserInfo"];//取cookie
            string UserName = "";
            string PassWord = "";
            if (cookie != null)
            {
                UserName = cookie["UserName"];
                PassWord = cookie["PassWord"];
            }
            ViewBag.UserName = UserName;
            ViewBag.PassWord = PassWord;
            return View();
        }


        public ActionResult Login(string userName, string passWord)
        {
            ///用户登陆
            HttpCookie cookie = new HttpCookie("UserInfo");//创建多值cookie
            cookie.Expires = DateTime.Now.AddDays(1);
            cookie.Values["UserName"] = userName;
            cookie.Values["PassWord"] = passWord;
            Response.Cookies.Add(cookie);
            return Content("OK");
        }


        public ActionResult FileUploadSetCookie(string userName, string passWord)
        {
            return View();
        }

    }
}